1. Field of the Invention
The present invention relates to a motion vector generation apparatus, motion vector generation method, and non-transitory computer-readable storage medium.
2. Description of the Related Art
In recent years, so-called multimedia-related information such as audio and video signals has been rapidly digitalized, and accordingly, compression encoding and decoding techniques of video signals have received a lot of attention. Since the compression encoding and decoding techniques can decrease a storage capacity required to store a video signal and a frequency band required for transmission, they are very important for multimedia industries.
These compression encoding and decoding techniques compress an information amount/data amount using high autocorrelations (that is, redundancies) for numerous video signals. The redundancy of a video signal includes a temporal redundancy and two-dimensional spatial redundancy. The temporal redundancy can be reduced using motion detection and motion compensation for respective blocks. On the other hand, the spatial redundancy can be reduced using discrete cosine transforms.
In, for example, the compression encoding and decoding techniques known as MPEG, the redundancy of a video signal is reduced by these methods, thereby improving data compression effect of video frames/fields, which change over time. Motion estimation for respective blocks required to reduce the temporal redundancy involves searching for the best approximate blocks between continuously input reference frames/fields (previous frames/fields) and a current frame/field. A vector which represents a moving direction and amount of a corresponding block is called a motion vector. Therefore, motion detection is synonymous with motion vector detection. Such motion vector detection is executed to divide a video signal into blocks that are each a motion vector detection unit (that is, a macroblock) of m pixels×n lines (m and n are integers), and to detect motion vectors for respective blocks. In a stream, since motion information has to be encoded, when a motion vector is to be searched, a similarity (distortion amount) of an image and an amount of code for a motion vector must be considered. In general, a motion vector search is conducted using an evaluation function (1) given by:C=D+λR   (1)where C is an evaluation function required to decide a motion vector, D is a difference, R is a generated code amount, and λ is a coefficient. As the difference D, a difference amount between an image to be encoded and a predicted image is used, and a difference square sum, difference absolute value sum, or the like is used. Also, a code amount of a motion vector is generally used as R, and a quantization step is generally used as λ.
The code amount R of the motion vector is calculated based on a difference amount from an estimated motion vector calculated from surrounding motion vectors in the compression method. Upon searching for a motion vector, surrounding motion vectors cannot always be accurately calculated, and the code amount R of the motion vector often cannot be normally evaluated. Japanese Patent Laid-Open No. 2008-154072 describes a method for solving such a problem.
However, with this technique, although the evaluation result of the code amount is improved, in an image in which a large amount of noise is generated due to an amplified camera gain on, for example, a dark part, the noise imposes a strong influence on the evaluation function C, and a correct motion vector often cannot be detected. For example, even when noise components are superposed on an image including a clear characteristic of an object such as a building or automobile (to be referred to as a characteristic image hereinafter), since the difference D is sensitized even to slight coordinate differences, detection errors of the motion vector are eliminated. On the other hand, when noise components are superposed on an originally flat image such as night sky (to be referred to as a characterless image hereinafter), since the difference D is strongly influenced by noise components, a motion vector cannot be set to be (0, 0) even in a still image, resulting in a detection error of a motion vector. As a result, small flicker components are generated, thus deteriorating an image. Hence, as disclosed in Japanese Patent Laid-Open No. 06-296276, a method of detecting a correct motion vector by applying noise reduction to an image to be encoded to eliminate noise components has been proposed.